package com.ldx.java_chatroom.mapper;

import com.ldx.java_chatroom.model.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {
    @Insert("INSERT INTO `user` (username,`password`) VALUES (#{username},#{password})")
    @Options(useGeneratedKeys = true,keyProperty = "userId")
    int insert(User user);
    @Select("select * from user where username = #{username}")
    User selectByName(String username);
}
